package com.journey.org.ui.home.news.list

import android.os.Bundle
import android.view.LayoutInflater
import android.view.ViewGroup
import com.journey.org.BR
import com.journey.org.R
import com.journey.org.databinding.FragmentNewsListBinding
import com.mvvmhabit.org.base.BaseLazyFragment

/**
 * @Date: 2020/11/23 9:40
 * @Author:小妖
 * @Description: 新闻列表
 */
class NewsListFragment : BaseLazyFragment<FragmentNewsListBinding, NewsListViewModel>() {

    private var type: String = ""

    override fun initParam() {
        super.initParam()
        type = arguments?.getString("type")!!
    }

    override fun lazyLoadData() {
        mViewModel?.loadNeteaseNewsList(type)
    }

    override fun initData() {
        super.initData()
        mViewModel?.onTypeField?.set(type)
    }

    override fun initVariableId(): Int = BR.viewModel

    override fun initViewModel(): Class<NewsListViewModel> = NewsListViewModel::class.java

    override fun initContentView(
        inflater: LayoutInflater?,
        container: ViewGroup?,
        savedInstanceState: Bundle?
    ): Int = R.layout.fragment_news_list

}